package com.wanhe.viewconf.adapter;

import android.content.Context;
import android.support.annotation.Keep;

import java.util.List;

/**
 * Created by cdj on 2017/1/13.
 */
@Keep
public abstract class BaseMenuPageItemAdapter<T> extends MenuPageItemAdapter {

    private List<T> mList;
    protected Context mContext;

    public BaseMenuPageItemAdapter(Context context, List<T> list){
        this.mContext = context;
        this.mList = list;
    }

    public void setData(List<T> list){
        if (mList != null){
            mList.clear();
            mList = null;
        }
        this.mList = list;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

}
